gl: Add a realize() fallback
authorEmmanuele Bassi <ebassi@gnome.org>
Mon, 23 May 2016 07:31:47 +0000 (08:31 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 23 May 2016 07:34:17 +0000 (08:34 +0100)
Calling gdk_gl_context_realize() should always result in a valid result,
so we need to provide a default implementation, to avoid a call to a
NULL function pointer.

gdk/gdkglcontext.c

index 44ef88b59a7ef4db38ee38e22046f232a7ad0def..40addbccaefb5a595837a9f0a1d30f2b0d3bb2ee 100644 (file)
@@ -286,11 +286,23 @@ gdk_gl_context_upload_texture (GdkGLContext    *context,
     }
 }
 
+static gboolean
+gdk_gl_context_real_realize (GdkGLContext  *self,
+                             GError       **error)
+{
+  g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
+                       "The current backend does not support OpenGL");
+
+  return FALSE;
+}
+
 static void
 gdk_gl_context_class_init (GdkGLContextClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
+  klass->realize = gdk_gl_context_real_realize;
+
   /**
    * GdkGLContext:display:
    *